const Home = () => import('@/views/home')
const Category = () => import('@/views/category')
const Cart = () => import('@/views/cart')
const Mine = () => import('@/views/mine')// duan
const detail = () => import('@/views/detail')
const Navbar = () => import('@/components/nav-bar')
const Tabbar = () => import('@/components/tab-bar')
const Right = () => import('@/views/category/right')
const Placeorder = () => import('@/views/cart/placeorder')
const Success = () => import('@/views/cart/success')
const ReceivingAddress = () => import('@/views/cart/receivingAddress')
const login = () => import('@/views/login')// duan
const register = () => import('@/views/register')// duan
const news = () => import('@/views/news')// duan
const payment = () => import('@/views/orderform/payment.vue')// 待付款
const delivergoods = () => import('@/views/orderform/deliverGoods.vue')// 待发货
const collect = () => import('@/views/orderform/collect.vue')// 待收货
const accomplish = () => import('@/views/orderform/accomplish.vue')// 已完成
const logistics = () => import('@/views/orderform/logistics.vue')// 物流跟踪
const search = () => import('@/views/search')
const add = () => import('@/views/readdress')
const question = () => import('@/views/question') // duan
const chat = () => import('@/views/chat')
const routes = [
  {
    path: '/',
    redirect: '/home',
  },
  {
    path: '/home',
    name: 'home',
    components: {
      header: Navbar,
      default: Home,
      footer: Tabbar,
    },
    meta: {
      title: '首页',
      icon: '&#xe600;',
      inBar: true,
    },
  },
  {
    path: '/category',
    name: 'category',
    components: {
      header: Navbar,
      default: Category,
      footer: Tabbar,
    },
    children: [
      {
        path: 'son',
        component: Right,
        meta: {
          title: '子分类',
        },
      },
    ],
    meta: {
      title: '分类',
      icon: '&#xe61e;',
      inBar: true,
    },
  },
  {
    path: '/cart',
    name: 'cart',
    components: {
      header: Navbar,
      default: Cart,
    },
    meta: {
      title: '购物车',
      icon: '&#xe642;',
      inBar: true,
    },
  },
  {
    path: '/placeorder',
    name: 'placeorder',
    components: {
      header: Navbar,
      default: Placeorder,
    },
    meta: {
      title: '提交订单',
    },
  },
  {
    path: '/address',
    name: 'address',
    components: {
      header: Navbar,
      default: ReceivingAddress,
    },
    meta: {
      title: '选择收货地址',
    },
  },
  {
    path: '/success',
    name: 'success',
    components: {
      default: Success,
    },
    meta: {
      title: '支付成功',
    },
  },
  {
    path: '/mine',
    name: 'mine',
    components: {
      header: Navbar,
      default: Mine,
      footer: Tabbar,
    },
    meta: {
      title: '我的',
      inBar: true,
      icon: '&#xe61f;',
    },
  },
  {
    path: '/detail',
    name: 'detail',
    components: {
      header: Navbar,
      default: detail,
    },
    meta: {
      title: '天鹅堡商城',
    },
  },
  {
    path: '/login',
    name: 'login',
    components: {
      default: login,
      header: Navbar,
    },
    meta: {
      title: '登录',
    },
  },
  {
    path: '/register',
    name: 'register',
    components: {
      default: register,
      header: Navbar,
    },
    meta: {
      title: '注册',
    },
  },

  {
    path: '/news',
    name: 'news',
    components: {
      default: news,
      footer: Tabbar,
      header: Navbar,
    },
    meta: {
      title: '消息中心',
    },
  },
  {
    path: '/payment',
    name: 'payment',
    components: {
      header: Navbar,
      default: payment,
    },
    meta: {
      title: '分销商城',
    },
  },
  {
    path: '/deliverGoods',
    name: 'deliverGoods',
    components: {
      header: Navbar,
      default: delivergoods,
    },

    meta: {
      title: '分销商城',
    },
  },
  {
    path: '/collect',
    name: 'collect',
    components: {
      header: Navbar,
      default: collect,
    },

    meta: {
      title: '分销商城',
    },
  },
  {
    path: '/accomplish',
    name: 'accomplish',
    components: {
      header: Navbar,
      default: accomplish,
    },
    meta: {
      title: '分销商城',
    },
  },
  {
    path: '/logistics',
    name: 'logistics',
    components: {
      header: Navbar,
      default: logistics,
    },
    meta: {
      title: '分销商城',
    },
  },
  {
    path: '/search',
    name: 'search',
    components: {
      header: Navbar,
      default: search,
    },
    meta: {
      title: '天鹅堡商城',
    },
  },
  {
    path: '/add',
    name: 'add',
    components: {
      header: Navbar,
      default: add,
    },
    meta: {
      title: '天鹅堡商城',
    },
  },
  {
    path: '/question',
    name: 'question',
    components: {
      default: question,
      footer: Tabbar,
      header: Navbar,
    },
    meta: {
      title: '问题中心',
    },
  },
  {
    path: '/chat',
    name: 'chat',
    components: {
      header: Navbar,
      default: chat,
      footer: Tabbar,
    },
    meta: {
      title: '聊天记录',
    },
  },
]

export default routes
